package com.myq.dao;

import org.junit.Test;

import java.util.Scanner;

import static org.junit.Assert.*;

public class UserDaoTest {
    UserDao userDao = new UserDao();

    @Test
    public void insertUser() {

        int flag = userDao.insertUser("zs","1920zs");
        int flag1 = userDao.insertUser("zyl","1920zyl");
        int flag2 = userDao.insertUser("wyx","1920wyx");
        if(flag == 1){
            System.out.println("注册成功");
        }else{
            System.out.println("注册失败");
        }
    }

    @Test
    public void login() {
////        Java接受键盘数据用Scanner
////        C语言里面用的是scanf
//        Scanner scanner = new Scanner(System.in);
//        System.out.println("请输入用户名");
////        接受键盘上输入的用户名
//        String uname = scanner.next();
//        System.out.println("请输入密码");
//        String upsw = scanner.next();
        boolean flag = userDao.login("zs", "1920zs");
        if(flag == true){
            System.out.println("登陆成功！");
        }else{
            System.out.println("用户名或密码登录错误！");
        }
    }

    @Test
    public void deleteUser() {
        int flag = userDao.deleteUser(1);
        System.out.println(flag);
    }

    @Test
    public void updataUser() {
        int flag = userDao.updataUser(2, "ls","123" );
    }

    @Test
    public void selectAllUser() {
        System.out.println(userDao.selectAllUser());
    }
}